package cn.szzsi.common.model;

import cn.szzsi.common.model.base.BaseTemplate;

import java.util.List;

/**
 * Created by yuanzheng on 2016/9/21.
 * 模板实体类
 */
//@TableBind(tableName = "b_template", pkName = "id")
public class Template extends BaseTemplate<Template> {
    public static final Template dao = new Template().dao();

    public static List<Template> getList(){
        return dao.find("select * from mall_template");
    }

    public static Template getByTemplateId(Integer id){
        return dao.findFirst("select * from mall_template where id=?",id);
    }

    public static Template getById(String uid){
        return dao.findFirst("select path from mall_template where id = (select b_template_id from mall_template_user where uid=?)",uid);
    }

    public static Template getByUseridAndAgent(String uid, String agent){//获取模板路径(wap模板和pc目标分开)
        return dao.findFirst("select path from mall_template where id = (select b_template_id from mall_template_user where uid=? and b_template_type = ?)",uid,agent);
    }


}
